Captcha.captchaService = '/admin/profile.php?a=captcha';

/* 初始化后台界面样式 */
window.addEvent("domready", function() {
    
    var uri = new URI(window.location.href);
    var key = uri.get("file") + "filterFolded";
    $$('.action-filter legend').each(function(item) {
        item.addEvent('click', (function(e) {
            el = $type(e) == 'element' ? e : $(e.target);

            var form = document.body.getElement(".action-filterform");
            var overTextInputs = form.getElements("input").filter(function(el){
                return el.retrieve("OverTextDiv") ? true : false;
            });

            el.toggleClass('folded');

            if (el.hasClass("folded")) {
                OverText.hideAll();
                Storage.write(key, 1);
            } else {
                Storage.write(key, 0);
            }

            var myFx = new Fx.Slide(form, {
                duration: 'short',
                onComplete: function() {
                    if (!el.hasClass("folded")) {
                        $$(overTextInputs).each(function(el){
                            OverText.showAll();
                        });
                    }
                }
            }).toggle();
        }).bindWithEvent(this));
    });

    if (Storage.read(key) == 1) {
        $$('.action-filter legend').each(function(el) {
            el.fireEvent("click", el, 500);
        });
    }

    $(document.body).getElements("a[target=_cpPage]").each(function(el){
        if (window.top.controlPanel) {
            $(el).addEvent('click', function(e) {
                e.stop();
                window.top.controlPanel.addNewPage(el.href).selected();
            });
        }
    });
});

